<p>
	The capital asset pricing model (CAPM) describes the relationship between systematic risk and expected return for assets, typically stocks. The formula for calculating the expected return of an asset given its risk is as follows:
</p>

\[r_a = r_f + \beta_a*(r_m - r_f) + \epsilon \]

<p>
	where:
</p>

\[r_f = Risk Free Rate\]
\[\beta = Beta of the security\]

\[r_m = Expected market return\]

\[\epsilon = Tracking error\]

<p>
	This formula can be better understood if we refactor the formula as seen below:
</p>

\[(r_a - r_f ) = \beta_a*(r_m - r_f) + \epsilon \]

<p>
	The left side of the equation gives us the difference between the asset return and risk free rate, the <strong>"excess return"</strong>. If we regress the <strong>market excess return</strong> against the <strong>asset excess return </strong>the slope represents the <strong>"beta"</strong> of the asset. Therefore, beta can also be calculated by the equation:
</p>

\[\beta = \frac{Cov(r_a,r_b)}{var(r_b)}\]

<p>
	So beta can be described as:
</p>

\[\beta = \rho _a,_b*\frac{\sigma _a}{\sigma_b}\]

<p>
	The formula above indicates that beta can be explained as<strong> "correlated relative volatility"</strong>. To make this simpler, beta can be calculated by doing a simple linear regression which can be viewed as a factor to explain the return, and the tracking error can represent alpha.
	To make this theory more convenient for our algorithm, we change the above formula into the following form:
</p>

\[r_a = \beta*r_m + r_f*(1-\beta) + \epsilon\]

<p>
	<strong>r*(1-β) </strong>on the right hand side of the equation is a very small item, making it negligible in the context of the Dow 30 companies. If we regress the stocks return with the return of the benchmark, the slope and intercept will be beta and alpha.
</p>
